package com.xhsj.user.hr.process.processDefinition.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xhsj.user.hr.process.hrLeaveProcess.query.FirstProcessNodeIdQuery;
import com.xhsj.user.hr.process.hrLeaveProcess.query.WorkFlowNodeQuery;
import com.xhsj.user.hr.process.processDefinition.entity.TbGlobalWorkFlowNode;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 流程设计-流程节点 Mapper 接口
 * </p>
 *
 * @author liuqinghua
 * @since 2020-08-28
 */
@Mapper
public interface TbGlobalWorkFlowNodeMapper extends BaseMapper<TbGlobalWorkFlowNode> {

    // 删除流程设计-流程节点
    int deleteByBusinessId(@Param("businessId") Long businessId);

    // 当前节点下一个节点相关的数据
    Map<String, Object> getNextNode(@Param("nodeId") long nodeId,
                                    @Param("businessId") long businessId);

    /**
     * 查询初始流程节点
     * @author liuqinghua
     * @date Aug 28, 2020 4:40:10 PM
     */
    List<FirstProcessNodeIdQuery> firstProcessNodeId(@Param("applyType") int applyType,
                                                     @Param("organizationId") Long organizationId);

    /**
     *  流程节点
     * @author liuqinghua
     * @date Aug 28, 2020 4:40:10 PM
     */
    List<WorkFlowNodeQuery> getNodeList(@Param("businessId") Long businessId);

    /**
     * 查询数据流程的最新节点
     * @author 苏小林
     * @date 2020/9/7 10:01
     * @param: businessId
     * @param: dataId
     * @return: java.lang.Long
     */
    Long findCurrentNodeId(@Param("businessId") Long businessId, @Param("dataId") Long dataId);

    /**
     * 查询当前节点的角色
     * @author 苏小林
     * @date 2020/9/11 17:07
     * @param: businessId
     * @param: nodeId
     * @return: java.lang.String
     */
    String getRoleByBusinessIdAndNodeId(@Param("businessId") Long businessId, @Param("nodeId") Long nodeId);

    Long getNodeIdByName(@Param("businessId") Long businessId,@Param("name") String name);
}
